package com.abigdreamer.im.server.DB.dao;

import java.util.ArrayList;
import java.util.List;

import com.abigdreamer.im.server.log.EIMLogger;
import com.abigdreamer.im.server.module.vo.MsgFriendGroup;
import com.abigdreamer.im.server.module.vo.MsgUser;

/**
 * 
 */
public class FriendGroupDao extends BaseDao implements IDAO {

	static List<MsgFriendGroup> allFriendGroupList = new ArrayList<MsgFriendGroup>();

	/**
	 * 
	 */
	public List<MsgFriendGroup> getAllFriendGroup() {
		UserDao userDao = new UserDao();
		EIMLogger.INFO("--->开始初始所有群信息列表！");
		for (int i = 0; i < 9; i++) {
			MsgFriendGroup team = new MsgFriendGroup();
			team.setGroupID(Integer.toString(6666 + i));
			team.setGroupName(Name.getFriendGroupName(i % 9));
			List<MsgUser> userList = new ArrayList();
			for (int k = 0; k < 10; k++) {
				// 80000-80099
				String userID = Integer.toString(i * 10 + k + 80000);
				userList.add(userDao.getUserByID(userID));
				if (k == 0) {
					team.setGroupOwerID(userID);
				}
			}
			team.setUserList(userList);
			allFriendGroupList.add(team);
			EIMLogger.INFO(team);
		}
		EIMLogger.INFO("<---所有群信息列表 初始完成！");
		return allFriendGroupList;
	}
}
